---
title: "Dashboard"
output:
flexdashboard::flex_dashboard:
orientation: columns
vertical_layout: fill
source: embed
---
```{r setup, include=FALSE}
library(flexdashboard)
library(tidyverse)
library(p8105.datasets)
library(plotly)
```
```{r}
instacartdf = instacart %>%
filter(aisle %in% c("baking ingredients", "dog food care", "packaged vegetables fruits"))
```
Column {data-width=650}
-----------------------------------------------------------------------
```{r}
instacart_df2 = instacart %>%
filter(aisle %in% c("packaged vegetables fruits")) %>%
group_by(aisle, order_hour_of_day, department, product_name) %>%
count(department)
```
### Chart A
```{r}
instacart_df2 %>%
plot_ly(x = ~order_hour_of_day, y = ~n, type = "scatter", mode = "markers", color=~department, alpha = 0.5, colors = "viridis")
```
Column {data-width=350}
-----------------------------------------------------------------------
### Chart B
```{r}
instacartdf %>%
mutate(department = fct_reorder(department, days_since_prior_order)) %>%
plot_ly(y = ~days_since_prior_order, color = ~department, type = "box", colors = "viridis")
```
### Chart C
```{r}
instacartdf %>%
count(department) %>%
mutate(department = fct_reorder(department, n)) %>%
plot_ly(x = ~department, y = ~n, color = ~department, type = "bar", colors = "viridis")
```